package com.zhan.rkforum.util;

import com.zhan.rkforum.bean.User;
import org.springframework.stereotype.Component;

/**
 * @author wujiazhan
 * @className HostHolder
 * @description TODO
 * @date 2021-06-16 11:33
 */
@Component
public class HostHolder {

    private ThreadLocal<User> users = new ThreadLocal<>();

    public void setUser(User user){
        users.set(user);
    }

    public User  getUser(){
        return users.get();
    }

    public void clear(){
        users.remove();
    }



}
